#!/bin/bash
# scripts/check_headers.sh

FILE_TYPES=("*.rs" "*.gd" "*.sol")
LICENSE_HEADER="SPDX-License-Identifier: MIT"

for type in "${FILE_TYPES[@]}"; do
  git diff --cached --name-only --diff-filter=ACMR -G "$type" | while read -r file; do
    if ! grep -q "$LICENSE_HEADER" "$file"; then
      echo "错误: $file 缺少MIT协议声明"
      exit 1
    fi
  done
done